using System;
using System.Collections.Generic;
using System.Text;
using BusinessObjects.BO_Actions.Settings;
using Entity.StoreProcedure;
using BusinessObjects;
using System.Data;
namespace BusinessObjects.BO_GetObjects 
{
	public static class BO_Settings
	{
        public static DataTable SelectByGroupId(int setting_group_id, int status)
        {
            try
            {
                BOSettings_Select_By_SetingGroupId action = new BOSettings_Select_By_SetingGroupId();
                usp_Settings_Select_By_SetingGroupId entity = new usp_Settings_Select_By_SetingGroupId();
                entity.SETTING_GROUP_ID = setting_group_id;
                entity.STATUS = status;
                return action.ExecuteAndReturnDataTable(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
		public static DataTable SelectAll(int status)
		{
			try
			{
				BOSettings_Select_All action = new BOSettings_Select_All();
				usp_Settings_Select_All entity = new usp_Settings_Select_All();
				entity.STATUS = status;
				return action.ExecuteAndReturnDataTable(entity);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public static DataTable SelectTop(int rows, int status)
		{
			try
			{
				BOSettings_Select_Top action = new BOSettings_Select_Top();
				usp_Settings_Select_Top entity = new usp_Settings_Select_Top();
				entity.NUMBERRECORD = rows;
				entity.STATUS = status;
				return action.ExecuteAndReturnDataTable(entity);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public static DataTable Search(int  setting_id)
		{
			try
			{
				BOSettings_Search action = new BOSettings_Search();
				usp_Settings_Search entity = new usp_Settings_Search();
				entity.SETTING_ID = setting_id;
				return action.ExecuteAndReturnDataTable(entity);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public static DataTable SelectWithPaged(int startIndex, int pageCount, int status)
		{
			try
			{
				BOSettings_Select_WithPaged action = new BOSettings_Select_WithPaged ();
				usp_Settings_Select_WithPaged entity = new usp_Settings_Select_WithPaged ();
				entity.STARTINDEX = startIndex;
				entity.MAXRECORDS = pageCount;
				entity.STATUS = status;
				return action.ExecuteAndReturnDataTable(entity);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public static string Insert( int setting_group_id, string setting_key, string setting_name, string setting_description, string setting_value, int setting_type, string setting_type_value, int sort_display, DateTime created_date, string created_by, DateTime modify_date, string modify_by, bool status)
		{
			try
			{
				BOSettings_Insert action = new BOSettings_Insert();
				usp_Settings_Insert entity = new usp_Settings_Insert();
				entity.SETTING_GROUP_ID = setting_group_id;
				entity.SETTING_KEY = setting_key;
				entity.SETTING_NAME = setting_name;
				entity.SETTING_DESCRIPTION = setting_description;
				entity.SETTING_VALUE = setting_value;
				entity.SETTING_TYPE = setting_type;
				entity.SETTING_TYPE_VALUE = setting_type_value;
				entity.SORT_DISPLAY = sort_display;
				entity.CREATED_DATE = created_date;
				entity.CREATED_BY = created_by;
				entity.MODIFY_DATE = modify_date;
				entity.MODIFY_BY = modify_by;
				entity.STATUS = status;
				return action.ExecuteAndReturnStringValue(entity);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public static string Update( int setting_id, int setting_group_id, string setting_key, string setting_name, string setting_description, string setting_value, int setting_type, string setting_type_value, int sort_display, DateTime created_date, string created_by, DateTime modify_date, string modify_by, bool status)
		{
			try
			{
				BOSettings_Update action = new BOSettings_Update();
				usp_Settings_Update entity = new usp_Settings_Update();
				entity.SETTING_ID = setting_id;
				entity.SETTING_GROUP_ID = setting_group_id;
				entity.SETTING_KEY = setting_key;
				entity.SETTING_NAME = setting_name;
				entity.SETTING_DESCRIPTION = setting_description;
				entity.SETTING_VALUE = setting_value;
				entity.SETTING_TYPE = setting_type;
				entity.SETTING_TYPE_VALUE = setting_type_value;
				entity.SORT_DISPLAY = sort_display;
				entity.CREATED_DATE = created_date;
				entity.CREATED_BY = created_by;
				entity.MODIFY_DATE = modify_date;
				entity.MODIFY_BY = modify_by;
				entity.STATUS = status;
				return action.ExecuteAndReturnStringValue(entity);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public static bool Delete(int setting_id)
		{
			try
			{
				BOSettings_Delete action = new BOSettings_Delete();
				usp_Settings_Delete entity = new usp_Settings_Delete();
				entity.SETTING_ID = setting_id;
				return action.ExecuteAndReturnBooleanValue(entity);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public static bool Restore(int setting_id)
		{
			try
			{
				BOSettings_Restore action = new BOSettings_Restore();
				usp_Settings_Restore entity = new usp_Settings_Restore();
				entity.SETTING_ID = setting_id;
				return action.ExecuteAndReturnBooleanValue(entity);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
	}
}

